home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 6_11.lha / 6_11 / runtests3 < prev    next >
Text File  |  1993-08-08  |  934b  |  42 lines

  1. ll="plus mult min div mod"
  2. wapall="swapplus swapmult swapmin swapdiv swapmod"
  3. f [ $# -eq 0 ]
  4. hen
  5.    set $all $swapall
  6. i
  7.  
  8. or i
  9. o
  10.    case $i in
  11.        build )
  12.     echo build sed
  13.     cp tst.in /tmp/tst.in.plus
  14.     sed 's!+!*!' < /tmp/tst.in.plus > /tmp/tst.in.mult
  15.     sed 's!+!-!' < /tmp/tst.in.plus > /tmp/tst.in.min
  16.     sed 's!+!/!' < /tmp/tst.in.plus > /tmp/tst.in.div
  17.     sed 's!+!%!' < /tmp/tst.in.plus > /tmp/tst.in.mod
  18.     for j in $all
  19.     do
  20.         echo build bc $j
  21.     bc < /tmp/tst.in.$j > /tmp/bc.out.$j
  22.         echo build swap $j
  23.     nawk '{print $3, $2, $1}' < /tmp/tst.in.$j > /tmp/tst.in.swap$j
  24.         echo build bc swap$j
  25.     bc < /tmp/tst.in.swap$j > /tmp/bc.out.swap$j
  26.     done
  27.     ;;
  28.    esac
  29. one
  30.  
  31. or i
  32. o
  33.    case $i in
  34.        build ) ;;
  35. * )
  36.     echo $i
  37.     ./tst3 < /tmp/tst.in.$i > /tmp/tst.out.$i
  38.     nawk '{ getline bc < "/tmp/bc.out.'"$i"'"; if (NF != 5 || $5 != bc) print $0, bc }' < /tmp/tst.out.$i
  39.     ;;
  40.    esac
  41. one
  42.